class Solution {
    char *strStr(char *haystack, char *needle) {
        if(haystack == NULL || needle == NULL) return NULL;
        char *p, *q;
        while(true) {
            p = haystack;
            q = needle;
            while(*p!='\0' && *q!='\0') {
                if(*p != *q) break;
                p++;
                q++;
            }
            if(*q=='\0') return haystack;
            if(*p=='\0') return NULL;
            haystack++;
        }
    }
};
